<?
include("include/mysql.config.php");
?>
<?
$action=$_GET["ac"];
$id=$_GET["id"];
?>

<?
//删除
if('del'==$action){
    if($id!=null){
        $sql="delete from massage where id=".$id;
        $time1=microtime();
        $result=mysql_query($sql);
        $time2=microtime();
        if($result){

            $_SESSION["message"]="删除成功";
            header("Location:admin.php");
        }
        else{
            header("Location:include/error.php");
        }
    }
}
if('add'==$action){
        $name=$_POST["name"];
        $mail=$_POST["mail"];
        $tel=$_POST["tel"];
        $birth=$_POST["birth"];
        $yuyue=$_POST["yuyue"]; 
        $types=$_POST["types"];
        $times=$_POST["times"];
        $knowFrom=$_POST["knowFrom"];
        $ip=$_SERVER["REMOTE_ADDR"];

        $sql="insert into massage (name,mail,birth,yuyue,type,times,knowFrom,ip)values('$name','$mail','$birth','$yuyue','$types','$times','$knowFrom','$ip,$tee')";

        echo $sql;

        $result=mysql_query($sql);
        if($result){
            echo "<script language='javascript'>alert('Successo');location='../index.html';</script>";
        }
        else{
            echo "<script language='javascript'>alert('字段不能有空！');location='../Prenotazion.html';</script>"; 
        
        }
}

?>
